home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
os2
/
splot170.zip
/
OS2SPLOT.HLP
< prev
next >
Wrap
Text File
|
1996-10-07
|
84KB
|
2,483 lines
<Product Info>
This is an integrated editor, C subset interpreter,
and scientific graphics program.
THIS PROGRAM WAS WRITTEN BY THOMAS W. STEINER
COPYRIGHT 1992 - 1996, ALL RIGHTS RESERVED
THERE IS NO WARRANTY OF ANY KIND. USE AT YOUR OWN RISK.
THIS IS NOT FREEWARE. TO REGISTER YOUR COPY SEND $50 TO
T.W. Steiner
2246 E. 6th Ave.
Vancouver, BC, V5N - 1R1
Canada
e-mail steiner@sfu.ca or
tsteiner@creo.bc.ca
Registered users will be able to download
upgrades as they become available.
<Help>
Select each menu item in the help menu to get an
overview of the program capabilities. Some important
user interface details that go beyond the standard
are also discussed in the menu help item.
<Cursor Motion>
The cursor may be moved around with the following keys:
#4 -- left one space
#6 -- right one space
#8 -- up one line
#2 -- down one line
#1 -- end of line
#7 -- beginning of line
#3 -- scroll down one screen
#9 -- scroll up one screen
#T -- left one word
#V -- right one word
#X -- up five lines
#R -- down five lines
#Q -- end of file
#W -- beginning of file
#S -- end of file
#Y -- beginning of file
#q -- end of page
#w -- top of page
#s -- down half a page
#y -- up half a page
<Mouse>
The mouse may be used to position the cursor as an
alternative to using the keyboard. Click on the
desired text location. The text may be scrolled using
the scroll bars at the sides.
All three mouse buttons are used to mark regions of
text by draging. The marking mode button assignments
are made in the editor configuration menu.
Double clicking on a word in a regular file causes
the editor to search for this word in an *.ndx file
and if found there starts up the info viewer. This is
useful in conjuction with function reference material
from compiler vendors. The path to *.ndx files is
specified in the editor configuration menu. Once set
up this enables context sensitive help on any
recognized word in the text.
Double clicking on a word in a readonly file causes
the editor to interpret that word as a file name and
loads that file. Integer numbers after the name if
any are interpreted as the line and column numbers
respectively. This is very convenient with the output
from a compiler invoked from the command line since
the output is added to the editor ring as a read only
file.
<Menus>
The menus function in a somewhat non-standard way.
The standard ALT f file menu access has not been
implemented since these keys are used for direct
accelerators. However key board menu access is still
possible by using the ALT key by itself if this is
enabled in the editor configuration.
To get help on any menu item click on it using the
right rather than the left mouse button.
Almost every menu item has an associated accelerator
which may be mapped to any other key or keys. Note
that if the keys are remapped this mapping will
appear in the menus after restarting the editor.
Since there are so many accelerator key definitions
the accelerators are case sensitive so look
carefully.
<Quit>
Exits from the currently displayed file. The next
file in the ring is displayed provided one exits. If
no other files are loaded the editor itself quits.
The number of loaded files is reported in the title
bar along with the current file name. If the file has
been modified a confirm dialog will be shown. To exit
from all the files and terminate the editor use the
"close" (or Alt F4) from the system menu.
The default accelerator is Ctrl q mapped to ^Q
<Save>
The editor writes the currently displayed file to
disk using the current name and path. If a newer file
of the same name exist then a confirm dialog will be
displayed.
The default accelerator is Ctrl w mapped to ^W
<Save As...>
The editor saves the currently displayed file to disk
using the specified name and path. A standard file
dialog is opened so that a filename can be typed or
chosen.
The default accelerator is Ctrl W mapped to ^w
<Save All Changed>
All files loaded that have had changes made to them
are saved to disk.
The default accelerator is Ctrl A mapped to ^a
<Open...>
A standard file dialog is displayed which allows
selection of a file to be edited. A wildcard '*' in
the name will load all matching files. Files may also
be loaded from the command line by typing
'^[ e yourfile.name'.
The default accelerator is Ctrl O mapped to ^o
<Next>
The next file in the ring of loaded files is displayed.
The default accelerator is Ctrl n mapped to ^N
<Prev>
The previous file in the ring of loaded files is
displayed.
The default accelerator is Ctrl p mapped to ^P
<Other...>
Opens a listbox dialog which displays a list of all
the files currently loaded. A file to be displayed
may be selected by double clicking on the chosen
filename. Changed files have the word changed
appended to the file name.
The default accelerator is Ctrl H mapped to ^h
<Config...>
Opens the editor configuration notebook. Many editor
preferences such as the colours may be set. The
results are saved in the ASCII file editor.cfg so
that the next time the editor starts it will use the
selected configuration. If multiple editor instances
are started only the first one will write the
editor.cfg file.
The default accelerator is Ctrl C mapped to ^c
<Cmd...>
Opens a command line dialog. Commands to the
operating system as well as editor command line
commands may be entered. The listbox displays a
history of the recently used command line commands
for reuse by double clicking on them. Command line
commands may also be entered without opening this
dialog by hitting the ^[ key. The editor command line
commands are as follows:
The default accelerator is Ctrl M mapped to ^m
Command Line Operations
^[ goto or leave command line
Change current line.
number goto line number n
+number down n lines
-number up n lines
Change current column offset.
@number start at column n
@+number scroll left n columns
@-number scroll right n columns
Search and Replace.
/str1[/-bclrw]
find string str (/ may instead be other punct)
c/str1/str2[/-bclrw] replace str1 with str2
The optional search suffixes are
/- search up (down is the default)
/b search marked block only
/c ignore case
/l loop through all loaded files
/r interpret as regular expression
/w match whole words only
For regular expressions the following symbols have
special meaning:
^ start of line
\$ end of line
. any character
\\ literal next character
+ match one or more times
* match zero or more times
[aei0-9] match a,e,i and 0 through 9
[^aei0-9] match anything but a,e,i and 0 through 9
( ) sub expression
a(ab)*b matches ab aabb aababb aabababb etc.
loading additional files to edit
e name1,name2,...[-brfl]
edit name1,name2,...[-brfl]
The optional edit suffixes are
-b binary mode
-r read only
-f num first line is line number num (-r implied)
-l num last line is line number num (-r implied)
cfg or configure show and modify editor config
help or ? activates help
quit exit without saving changes
m [name] or insert named file at cur location
merge [name]
r [name] or rename current file to name
rename [name]
d [name] or diff between current and named file
diff [name] diff between current and named file
up arrow previous command line entered
down arrow next command line entered
fill [string] fill B marked block with string
sort [col] sort lines using field col as key
hex [num] or hex 'c' convert decimal num or char to hex
dec [num] or dec 'c' convert hex num or char to decimal
asc [num] convert hex or dec number to char
cd [y:\path] set default drive and path
os [command] send command to operating system
[command] sent to operating system
The results of the above operating system calls will
end up in a temp file in the ring of files. There is
a difference between the above two methods. When a
command is prefixed by "os" the command runs
synchronously i.e. the editor is blocked until the os
command completes. If the "os" prefix is absent the
system call runs in back ground. This is useful for
compiling code or doing long searches in background
for example.
Lastly, any string that is sent to the operating system
will first have any occurances of \$EDNAME translated to
the current filename. In this way a generic macro that
does an os call may be built.
<Delete Character>
Deletes the character under the cursor.
The default accelerator is Ctrl d mapped to ^D
<Delete Prev Char>
Deletes the character to the left of the cursor. If
the cursor is at the start of a line it will join the
current line to the previous line.
The default accelerator is Backspace mapped to ^H
<Delete Word>
Deletes all characters under and to the right of the
cursor up to the next space or punctuation.
The default accelerator is Ctrl z mapped to ^Z
<Delete to Line end>
Deletes all characters under and to the right of the
cursor up to the end of the line.
The default accelerator is Ctrl e mapped to ^E
<Delete Line>
Deletes the entire current line.
The default accelerator is Ctrl Back mapped to ^?
<Insert New Line>
The behaviour of this command is dependent on the
'conventional return' configuration setting. If
conventional return is on then the current line is
split at the cursor and the remainder is put on the
next line. If however, conventional return is not
enabled then this command inserts a blank line below
the current line leaving the current line intact.
This behaviour is compatible with the 'e' series of
editors.
The default accelerator is Enter mapped to ^M
<Change Char Case>
Changes the case of the character under the cursor.
The default accelerator is Ctrl c mapped to ^C
<Swap two Chars>
Swaps the character under the cursor with the one
to the right of the cursor.
The default accelerator is Ctrl s mapped to ^S
<Insert Ctrl Char>
This command starts a dialog for entering the 3 digit
ASCII code of a character to be inserted in the text.
This is useful for inputing characters without a key
board key.
The default accelerator is Alt x mapped to %X
<Insert Literal Char>
This is only active if key mapping is turned on in
the editor configuration menu. If it is turned on
then this command will for the next key stroke
disable the translation so that the original
functionality may be accessed.
The default accelerator is Alt k mapped to %K
<Cut Line at Cursor>
This command splits the current line at the cursor
puting the remainder of current line on the next
line. Similar to Insert New Line if conventional
return is enabled. Used to split lines if
conventional return is not enabled.
The default accelerator is Ctrl k mapped to ^K
<Join two Lines>
This command joins the next line to the end of the
current line.
The default accelerator is Ctrl j mapped to ^J
<Left justify line>
This command adjusts the indentation of the current
line to match that of the next non blank line above.
If a block of lines was just copied or moved this key
will adjust the indentation of the whole block.
The default accelerator is Alt j mapped to %J
<Toggle Ins/Del>
This command toggles the character insertion mode
between insertion and replacement. The current status
is reported on the right end of the status line.
The default accelerator is Ctrl t mapped to ^T
<Undo>
The last changes to a line or block of lines are
restored. The number of undo levels are essentially
unlimited but can be otionally disabled in the editor
configuration menu.
The default accelerator is Ctrl u mapped to ^U
<Redo>
Steps undone with the undo command can be redone with
this command.
The default accelerator is Ctrl r mapped to ^R
<Restore Current Line>
If the undo record for the current line is of the
line change type then the line can be restored to its
previous state using this command. The difference
between this command and undo is that this command
can restore a line in some cases without having to
undo changes made after the current line was
modified.
The default accelerator is Alt q mapped to %Q
<Reflow>
This command has two different modes of operation. If
syntax colouring is not on then this command
reformats a paragraph of text using the margins and
indentation specified in the editor configuration
notebook. The reformating starts at the current line
and ends at the first blank line. Alternatively a
block mark may be set to specify the margins and text
to reflow.
If syntax colouring is on then it is assumed that the
text is C code and it is reformated with smart
indentation At this point the rules are not
configurable and may not suit everyone's taste.
The default accelerator is Alt r mapped to %R
<First Column Lines>
This command folds up the current file so that only
those lines starting in the first column are visible.
This is useful for rapidly locating functions in a
file. If the file is already folded then this command
unfolds the file around the line current line.
The default accelerator is Ctrl v mapped to ^V
<Lines with search string>
This command folds up the current file so that only
those lines containing the last used search string
are visible. If the file is already folded then this
command unfolds the file around the line current
line.
The default accelerator is Alt s mapped to %S
<Changed Lines>
This command folds up the current file so that only
those lines which have been modified since the last
save are visible. If the file is already folded then
this command unfolds the file around the line current
line.
The default accelerator is Alt v mapped to %V
<Lines with placemark>
This command folds up the current file so that only
those lines which contain a placemark are visible. If
the file is already folded then this command unfolds
the file around the line current line.
The default accelerator is Alt h mapped to %H
<Tagged foldup>
This command folds up the current file so that the
lines between the numerically greatest remaining fold
tag and the next fold tag are hidden. The fold tag is
a regular expression set in the editor configuration
dialog and should be picked to be a comment in the
language in use. For example the default regular
fold tag expression is //[ ]*L[0-9]+ which is a comment
in C++. This will match // L1 and // L21 for example.
The number represents the fold level.
Tagged foldup is the only folding mode that requires
special entries in the file. However, a file written
with folding in mind can make use of these tags to
selectively hide details to present an overview.
The default accelerator is Alt - mapped to %-
<Tagged unfold>
Unfolds previously folded text by one level if folded
by tagged foldup. If folded in another mode the file
is completely unfolded. The file is unfolded around the
current line.
The default accelerator is Alt + mapped to %+
<Tabbed foldup>
This command folds up the current file so that the
most indented text which remains visible is hidden.
This provides a means of hidding the details of a
large switch() for example to get an overview.
The default accelerator is Ctrl - mapped to ^-
<Tabbed unfold>
Unfolds previously folded text by one level if folded
by tabbed foldup. If folded in another mode the file
is completely unfolded. The file is unfolded around the
current line.
The default accelerator is Ctrl + mapped to ^+
<Split Screen>
The screen is split into an upper and lower half each
of which can show the same or a different file. If the
screen is already split then it is unsplit.
The default accelerator is Ctrl y mapped to ^Y
<Other Split Half>
This command is only active if the screen is split in
which case it moves the cursor to the other split half.
It is also possible to click with the mouse to select
the other half.
The default accelerator is Ctrl o mapped to ^O.
<Alternate Binary Rep>
If the file being edited is a binary file then this command
switches from the hex representation to a text and control
key representation.
The default accelerator is Alt a mapped to %A.
<Normal Mark>
This is the industry standard mode of text marking which
is of more use with standard text than with program code.
Use this command to mark the start and end of a region.
A region may start in the middle of a line extend over
several lines and end in the middle of a line.
The default accelerator is Alt n mapped to %N.
<Unmark>
Unmark any text marked in any one of the three marking
modes.
The default accelerator is Alt u mapped to %U.
<Delete region>
This deletes a region marked in any one of the three
marking modes.
The default accelerator is Alt d mapped to %D.
<Move region>
This moves a region marked in any one of the three
marking modes to the location in the same or different
file specified by the current cursor location.
The default accelerator is Alt m mapped to %M.
<Copy region>
This copies a region marked in any one of the three
marking modes to the location in the same or different
file specified by the current cursor location.
The default accelerator is Alt c mapped to %C.
<Yank back last del>
The last region deleted can be restored once or many
times using this command. The last deleted text is
inserted at the current cursor location in the same
or different file. Note that the text may be brought
back in any location so that this provides a means
of moving text in a method conceptually similar to
using a clip board.
The default accelerator is Alt y mapped to %Y.
<Write region>
The currently marked region is written to a temp
disk file with name 'editblck.tmp' in the current
directory.
The default accelerator is Alt w mapped to %W.
<Mark lines(s)>
This is the prefered marking mode for program
text. Only whole lines are marked and line marked
text when inserted on a copy does not split the
current line as in normal marked case but inserts
the marked lines below the current line.
The default accelerator is Alt l mapped to %L.
<Justify>
This command left adjusts the current line with the
first non-blank line above and then moves the cursor
down to the next line. As a special case if the last
operation was a marked region move or copy then the
whole block is shifted left or right as necessary
to left adjust the first line.
The default accelerator is Alt j mapped to %J.
<Mark Rect Block>
This command is used to mark a rectangular block
for column manipulations.
The default accelerator is Alt b mapped to %B.
<Fill Rect>
A previously marked rectangle may be filled with
a single character. To fill with a word use the
command line command 'fill xyz'. Alternatively,
this command may be used to change the case of
all the characters in the marked block. Lastly,
this command may be used to fill with a sequence
of incrementing or decrementing numbers starting
with the number found at the top of the block
marked region region.
The default accelerator is Alt f mapped to %F.
<Overlay Block>
The block marked region is used to overwrite a
same sized region the top left corner of which
is specified by the current cursor location.
The default accelerator is Alt o mapped to %O.
<Move Rect Left>
A block marked region may be moved to the left
by one space with this command. The contents of
the column to the left of the block is deleted.
The text to the right of the marked block moves
with the text. This command is useful for adjusting
the indentation of a section.
The default accelerator is Alt Left mapped to #t.
<Move Rect Right>
A block marked region may be moved to the right
by one space with this command. The text to the
right of the marked block moves with the text.
This command is useful for adjusting the indentation
of a section.
The default accelerator is Alt Right mapped to #v.
A block marked region may be shifted to the left
by one space with this command. The contents of
the left most column of the block is deleted and
the width of the block shrunk by one
The text to the right of the marked block moves
with the text. This command is useful for adjusting
the indentation of a section.
The default accelerator is Alt Left mapped to #t.
<Move Rect Up>
A block marked region may be moved up by one line
with this command. The contents of the line above
the block is split to accomodate the block.
The default accelerator is Alt Up mapped to #x.
<Move Rect Down>
A block marked region may be moved down by one line
with this command. The contents of the line below
the block is split to accomodate the block.
The default accelerator is Alt Down mapped to #x.
<Shift Rect Left>
A block marked region may be shifted to the left
by one space with this command. The left most column
of the block is deleted and the marked region's width
is reduced by one provided the width of the column is
wider than one. If not the block width stays at one and
a new column is shifted in from the right. Text to the
right of the marked block shift with the text in the
block. This command is useful for adjusting
the indentation of a section.
The default accelerator is Ctrl ^ mapped to ^^.
<Shift Rect Right>
The text in block marked region may be shifted to the
right by one space with this command. The right most
column of the block is filled with spaces Text to the
right of the marked block shift with the text in the
block. This command is useful for adjusting
the indentation of a section.
The default accelerator is Ctrl _ mapped to ^_.
<Copy to Clipboard>
This command copies a region marked in any one of the
three marking modes to the system clip board.
The default accelerator is Ctrl ins mapped to #P.
<Copy From Clipbrd>
This inserts lines of text from the system clipboard
below the current line.
The default accelerator is Shift Ins mapped to #a.
<Copy to Clip and Del>
This command copies and deleted a region marked in any
one of the three marking modes to the system clip board.
The default accelerator is Shift Del mapped to #d.
<Toggle Placemark>
This command sets a placemark on the current line if
there is not already a placemark otherwise it removes
the place mark.
The default accelerator is Ctrl a mapped to ^A.
<Goto Last Place>
This command moves the cursor to the next location
marked by a previously set placemark.
The default accelerator is Ctrl l mapped to ^L.
<Clear Placemarks>
This command clears all previously set placemearks.
The default accelerator is Alt i mapped to %I.
<Goto Last Pos>
This command returns the cursor to the line it was on
previously. This command is useful in case the cursor
was accidentally removed from the region of interest
with an uninteded search for example.
The default accelerator is Alt p mapped to %P.
<Match Bracket>
This command moves the cursor to the location matching
the bracket or comment start underneath the cursor.
Note that the cursor must currently be positoned on a
bracket or comment delimiter.
The default accelerator is Ctrl b mapped to ^B.
<Goto Line num>
This command opens a dialog for entering the line number
of the desired current line. There is also a command
line equivalent which is:
^[ nnn Enter
<Teach Macro (start,end)>
This command starts or ends the recording of keystrokes
for a macro. At the end of macro recording it may be
optionally bound to a function key for preservation
between editing sessions. Otherwise it will be stored
for re-execution with the Exec Last Macro command until
the end of the current editing session unless over
written by another recorded macro.
Macros can be used together with command multiplication
to carry out repetitive complex editing tasks.
The default accelerator is Alt t mapped to %T.
<Exec Last Macro>
This command executes the last recorded macro. Bound
macros are executed by hitting the corresponding
function key.
The default accelerator is Alt e mapped to %E.
<Zero Cmnd Mult>
This command is used re set a previously entered
command multiplier to zero,
The default accelerator is Alt z mapped to %Z.
<Cmnd Multiplier>
This command opens a dialog to enter a command multiplier.
Command multiplication is very useful in conjuction with
recorded macros for executing complex repetitive editing
tasks. The default accelerators are:
Alt 0 to Alt 9 mapped to %0 to %9.
<Find...>
This command opens the search dialog used to enter the
search string and search options. Search options are:
search up (down is the default)
search marked block only
ignore case
loop through all loaded files
interpret as regular expression
match whole words only
For regular expressions the following symbols have
special meaning:
^ start of line
\$ end of line
. any character
\\ literal next character
+ match one or more times
* match zero or more times
[aei0-9] match a,e,i and 0 through 9
[^aei0-9] match anything but a,e,i and 0 through 9
( ) sub expression
a(ab)*b matches ab aabb aababb aabababb etc.
The default accelerator is CTRL S mapped to ^s.
<Replace...>
This command opens the search and replace dialog used to
enter the search and replace strings as well as the
search options. Search options are:
search up (down is the default)
search marked block only
ignore case
loop through all loaded files
interpret as regular expression
match whole words only
For regular expressions the following symbols have
special meaning:
^ start of line
\$ end of line
. any character
\\ literal next character
+ match one or more times
* match zero or more times
[aei0-9] match a,e,i and 0 through 9
[^aei0-9] match anything but a,e,i and 0 through 9
( ) sub expression
a(ab)*b matches ab aabb aababb aabababb etc.
The default accelerator is CTRL R mapped to ^r.
<Find Next>
This command uses the last set search string and option
to find the next match.
The default accelerator is CTRL f mapped to ^F.
<Change Dir & Find>
This command uses the last set search string and option
to find the next match after toggling the current
search direction
The default accelerator is CTRL F mapped to ^f.
<Find Next cur word>
This command uses the word under the cursor as the
temporary search string and finds the next such match.
The default accelerator is Alt * mapped to %*.
<Find Prev cur word>
This command uses the word under the cursor as the
temporary search string and finds the previous such
match.
The default accelerator is Alt / mapped to %/.
<general>
To plot a figure load a .spt file.
For example:
<esc> edit demo\logaxes.spt or use the 'Open'
button in the 'File' menu.
then hit CTRL G or 'Execute' button.
The next section explains how to use the mouse. For
help with the editor select help in the editor window.
Using The Mouse
Double clicking the left mouse button with the mouse on
the drawing page inserts the current x,y coordinates into
the text file at the current text cursor location. If the
mouse cursor is in the text region then hitting the left
mouse button will move the current text cursor to the mouse
cursor location. The left mouse button is also used to
select items in drop down menus. A rubber band box is drawn
by pressing the left mouse button with the mouse over the
plot window and dragging the mouse with the left button held
down. The second point of the box is set to the location at
which the button is released. Double clicking the left mouse
button in the text window results in an action depending on
the type of file and type of word under the mouse cursor.
If the word under the cursor is a variable the value of the
variable or constant is displayed. If the word is a
function then the help screen for that function will be
loaded. If the current file has a read only attribute then
the editor attempts to interpret the word under the cursor
as a file name and subsequently load in that file.
The right mouse button is used for highlighting
elements of a drawing. If the mouse cursor is on top of a
displayed element on the drawing page and the right mouse
button is hit then the corresponding element is highlighted
in intense white and the text cursor jumps to the
corresponding line in the text that generated that element.
Conversely, if the mouse cursor is on the text side hitting
the right mouse button will highlight any graphics elements
generated by the line under the mouse cursor. This feature
is very useful for finding the code associated with a
particular element of a drawing or the reverse. Clicking the
right mouse button on a drop down menu item will open a
help window for that item if available.
When the mouse cursor is on the drawing page the
current coordinates are printed at the bottom. The units
and origin used are those in effect at the end of the last
program execution. The default units are cm with the origin
in the bottom left corner of the page. Pressing the middle
mouse button (or both the left and right mouse buttons
together on two button mice) with the mouse pointer on the
drawing page causes the current coordinate reference point
to be reset so that the current coordinate line
subsequently reports the distance from this point.
In the editor window the mouse can also be used to mark a
region. Three types of regions are available and can be
assigned to any one of three mouse buttons as set up in the
"config" notebook of the "file" menu.
Actions associated with the menu buttons
There are several menu buttons along the top of the
display. The action of these buttons is as follows.
Starting at the left top there are four buttons labelled
'Draw', 'Slib', 'Cnst', 'SetO' and 'Keyw'. These activate
drop down menus which allow a function to be selected and
inserted into the text. The 'Draw' functions are a suite of
drawing routines which cause lines, arcs, text etc. to be
drawn to the page. The 'SetO' menu is a list of textual
names for numerical constants which are used in conjunction
with the set(); command to change attributes of the current
graphics state such as the current colour, line width, line
style, axes type, etc. Choosing set from the list of
drawing functions automatically opens a menu with only an
appropriate subset of these and is the recommended
approach. The 'Slib' button allows selection of a standard
C library function. Most of these are math functions such
as sin() and will not be required for making ordinary
plots. They are however useful for manipulating data before
plotting or generating data mathematically all from within
Splot. The 'Cnst' button opens a menu containing all the
constants defined in splot.h. The last button of this group
'KeyW' opens a list of C keywords for selection. The only
one of these that is of interest for ordinary plots is
'main'. Every file that generates a plot or drawing must
start with
#include splot.h
main
{
/* list of drawing commands go here */
/* between the braces on as many*/
/* lines as necessary */
}
This is all automatically inserted in the text by
selecting 'main'. The remaining keywords in this list are
only of interest when constructing loops or branches.
The next button labelled 'Misc' opens a sub menu
containing the options 'Reset', 'Redraw' , 'Coord Match'
and 'Relative Coord'. 'Reset' resets splot to its initial
state and erases the current drawing. The 'Redraw' button
can be useful if Splot is in the incremental draw mode in
order to fix up blemishes caused by out of order drawing ad
erasing. 'Redraw' just re draws the current plot. The button
'Coord Match' toggles the current units from cm to units
matching those defined in the last axes_box() and back. The
button 'Relative Coord' toggles the coordinate display from
reporting the absolute coordinate to reporting the distance
between the mouse position and the current point defined
using the middle mouse button or double clicking the left
mouse button over the plot window.
The next button along the top is concerned with
displaying the drawing. The default size of the drawing is
one which fits on a standard 8 x 11 inch piece of paper if
printed. However, as the screen resolution is not as good
as that of printers it is possible to zoom in on part of a
drawing in order to get a better view. To zoom in on part
of a drawing hold down the left button and drag the mouse
to enclose the region of interest. Then select the zoom
button and pick the drop down menu item 'Box Zoom'. The
button 'Undo Zoom' restores the previous view. The buttons
'Save View' and 'Rest View' allow interesting views to be
saved on a stack and restored respectively.
<abs>
int abs(int i);
Returns the absolute value of i;
<acos>
double acos(double x);
Returns the arc cosine of the value x. x must be
between -1 and 1. Returns a value between 0 and pi.
<arraydim>
int arraydim(void *array,int i);
Returns the number of elements in the ith dimension
of the array. Returns -1 if it is not an array or if
i is greater than the number of dimensions of the array.
Dimension counting starts at 0. The second parameter is
optional and if omitted the function returns the
dimensions of the array.
This is not a standard C library function.
<arraydup>
void *arraydup(void *array);
Returns a pointer to a duplicate of the array.
Memory is malloced for the new array and the values
in the old array copied to the new one.
This is not a standard C library function.
<asin>
double asin(double x);
Returns the arc sine of the value x. x must be between
-1 and 1. Returns a value between -pi/2 and pi/2.
<atan>
double atan(double x);
Returns the arc tangent of the value x. Returns a value
between -pi/2 and pi/2.
<atan2>
double atan2(double y,double x);
Returns the arc tangent of the value y/x. Returns a value
between -pi and pi.
<atoi>
int atoi(char *str);
Converts a string to an integer. The string must contain
only digits.
<atof>
double atof(char *str);
Converts a string to a double. The string must contain only
digits and 'e', 'E', '.', '-' and '+' .
<ceil>
double ceil(double x);
Rounds up x to nearest integer value.
<cos>
double cos(double x);
Returns the cosine of x. x is specified in radians.
<ctime>
char *ctime(int tim);
Returns a pointer to an ASCII string containing the
current date and time. The passed parameter should
be the value returned by the time() function for
the current time and date.
example:
puts(ctime(time()));
<exit>
void exit(int status);
Terminates the execution of the program. If the status is 0
then it will be considered a normal exit otherwise an error
induced exit.
<exp>
double exp(double x);
Calculates the exponential function e^x.
<fabs>
double fabs(double x);
Returns the absolute value of x. It is like abs() but works
with floating point numbers rather than integers.
<floor>
double floor(double x);
Rounds down x to the nearest integer.
<fmod>
double fmod(double x,double y);
Returns the remainder of x/y.
<free>
void free(char *ptr);
Frees the block of memory pointed to by ptr. The memory
must have been previously allocated using malloc().
<log>
double log(double x);
Returns the natural log of x.
<log10>
double log10(double x);
Returns the log base 10 of x.
<malloc>
char *malloc(int size);
Allocates a block of memory of size bytes and returns a
pointer to the block. malloc returns NULL if there is
insufficient free memory.
<max>
double max{double x,double y);
Returns the larger of x or y. This is NOT a standard
C library function.
<min>
double min{double x,double y);
Returns the smaller of x or y. This is NOT a standard
C library function.
<pow>
double pow(double x,double y);
Calculates x to the power y.
<puts>
int puts(char *str);
This routine writes the string str to the output file and
starts a new line.
<printf>
int printf(char *format,...);
Prints the formatted data to the output file. The format
string specifies the type and number of values to print.
Some common examples include:
printf("i = %d",i); prints the
integer value i.
printf("x = %g",x); prints the
floating point value x.
printf("text = %s",str); prints the
string str.
Multiple values can be printed as in
printf("%d %d %g %s",i,j,x,str);
The format specifiers can also include field width
information and justification etc. Consult a standard C
text for more details.
<print>
void print(v,...);
Prints the value v which can be of any scalar type. i.e
int, char, float, double or a pointer. This is not a
function found in the standard C library.
<rand>
int rand();
Returns random number between 0 and
0x7FFF. Reseed using srand();
<sin>
double sin(double x);
Returns the sine of x. x must be specified in radians.
<sqrt>
double sqrt(double x);
Calculates the square root of x. x must be a positive
number.
<srand>
void srand(int seed);
Reseeds the random number generator.
Implicitly started with a seed of 1.
<sizeof>
int sizeof(t);
Returns the number of bytes required to store the value of
type t.
<sprintf>
int sprintf(char str,char
*format,...);
Prints the formatted data to the string str. The format
string specifies the type and number of values to print.
Some common examples include:
printf("i = %d",i); prints the
integer value i.
printf("x = %g",x); prints the
floating point value x.
printf("text = %s",str); prints the
string str.
Multiple values can be printed as in
printf("%d %d %g %s",i,j,x,str);
The format specifiers can also include field width
information and justification etc. Consult a standard C
text for more details.
<strcat>
void strcat(char *dest, char
*source);
Concatenates the string source to the string dest.
<strcpy>
void strcpy(char *dest, char
*source);
Copies the string source to the string dest.
<strcmp>
int strcmp(char *s1, char *s2);
Compares the string s1 to the string s2.
Returns < 0 if s1 is lexically < s2
returns 0 if s1 equals s2
Returns > 0 if s1 is lexically > s2
<strlen>
int strlen(char *str);
Returns the length of the string str.
<tan>
double tan(double x);
Calculates the value of the tangent of x. x should be
specified in radians.
<time>
int time();
Returns the number of seconds elapsed since 00:00:00
GMT January 1, 1970. Similar to the standard C library
function time() but does not take a parameter.
Generally used in conjunction with ctime();
<abox>
void abox(double xsi, double
ysi, double xorig,
double yorig);
Adds an axes box to the current path. The box is drawn with
a size of xsi by ysi and centered on the page. No internal
coordinate system is set up. Use ascale() for this or use
axes_box() to combine both functions. All the parameters
are optional and if present, specify the box size and
position of the axes origin relative to the page origin. For
the last two parameters the special constants XCENTER and
YCENTER can be used for the x or y position coordinate
respectively and will cause the axes box to be centered on
the page along that axis. Using both XCENTER and YCENTER is
equivalent to the default behaviour with the last two
parameters absent. If no parameters are specified a default
size of 12 by 16 cm is used and the box centered on the page.
abox() is implicitly stroked.
<alineto>
void alineto(double len, double ang);
Adds a line of length len at an angle of ang with respect
to the previous line to the current path. Generates an
error if there is no current point. If there is no
previous line then a horizontal line ending at the
current point is assumed. The angle is in degrees and is
the angle between an imaginary extension to the previous
line and the current line.
<arc>
void arc(double xcen, double ycen, double rad, double
alpha, double beta);
Adds a circular arc of radius rad centered at (xcen, ycen)
to the current path. The starting angle is alpha and the
stopping angle is beta. The arc is drawn in the counter
clockwise direction. A straight line section will be added
from the previous current point if any to the starting
point of the arc.
<arcn>
void arcn(double xcen, double ycen, double rad, double
alpha, double beta);
Adds a circular arc of radius rad centered at (xcen, ycen)
to the current path. The starting angle is alpha and the
stopping angle is beta. The arc is drawn in the clockwise
direction. A straight line section will be added from the
previous current point if any to the starting point of the
arc. Exactly as arc() but draws the arc in the opposite
direction.
<arcto>
void arcto(double x1, double y1, double x2, double y2,
double rad);
Adds a circular arc of radius rad to the current path. The
center and angles are chosen so that the arc is tangent to
the line formed by (x1,y1) and the current point at its
start and tangent to the line (x1,y1) - (x2,y2) at its end
point. A straight line segment is added from the current
point to the start of the arc. An error is generated is
there is no current point.
<arrowto>
void arrowto(double x,double y,...);
Adds a line segment to the current path from the current
point to (x,y). The line is terminated by drawing an arrow
head oriented in the direction of the line. More than one
coordinate point can be specified in the command in which
case a series of line segments terminated by arrows
connecting the points will be added to the current path. If
there is no current point then an error will be generated.
The size of the arrow head may be changed with the
set(FONTWIDTH,...); command.
<ascale>
void ascale(int axes, double xstart, double ystart, double
xend, double yend);
or
void ascale(int axes, double *data, int col,...);
An internal coordinate system is set up for subsequent
plotting of data within the existing axes box. The x axis
start and stop values are xstart and xend respectively and
ystart, yend for the y axis. for the y axis. If the axis
choice is XAXES or YAXES rather than XYAXES then only two
numbers follow the axes specifier rather than four. This
allows the x and y axes scales to be set independently of
each other. The alternate format allows for auto scaling to
the specified data. There can be more than one data array
in the list in which case the scales are chosen so that
they will all fit. Each data array can optionally be
followed by one or two integers specifying which columns to
use for the x and y values. If axes is not XYAXES only one
integer is allowed.
<axes_box>
void axes_box(double xsi, double ysi, double xstart, double
ystart, double xend, double yend,double xorig, double
yorig);
Adds an axes box to the current path. The box is drawn with
a size of xsi by ysi and centered on the page. An internal
coordinate system is set up for subsequent plotting of data
within the box. The x axis start and stop values are xstart
and xend respectively and ystart, yend for the y axis. for
the y axis. The last two parameters are optional and if
present specify the position of the axes origin relative to
the page origin. For the last two parameters the special
constants XCENTER and YCENTER can be used for the x or y
position coordinate respectively and will cause the axes
box to be centered on the page along that axis. Using both
XCENTER and YCENTER is equivalent to the default behaviour
with the last two parameters absent. More flexibility is
provided by the pair of functions abox() and ascale() which
provide the functionality of axes_box() in several steps.
axes_box() is implicitly stroked.
<box>
void box(double x1, double y1, double x2, double y2);
Adds a box to the current path. The two end points of the
box are (x1,y1) and (x2,y2);
<clear>
void clear();
Clears the screen when the program is executed. Also
the list of drawable elements is deleted.
This function should not be needed for ordinary plots.
<clip>
void clip()
Converts the currently defined path into a clipping path.
All subsequent drawing operations are then clipped against
this path and only portions of the drawing on the inside of
the clip path are displayed. What is inside and what is
outside depends on whether even-odd or non-zero wind has
been selected as the fill rule using a set(); If the
current path is not closed then the current path is first
closed. If there is no current path an error is generated.
Clip() is implicitly stroked and takes effect immediately.
<closepath>
void closepath();
Closes the current path. A straight line segment is added
from the current point to the start of the current path as
set by the moveto() of rmoveto() command at the beginning
of the path definition. Generates an error if there is no
current point.
<cmatch>
void cmatch(int on);
If the passed parameter is TRUE then it does the necessary
translations and scaling so that the coordinate system for
the page matches that used within the axes_box. An error is
generated if there is no current axes_box. The font scale
is compensated automatically for the change in coordinate
system so that characters will still be the same size as
before. If the parameter is FALSE then the previous
unmatched coordinates will be restored. If there is no
parameter TRUE is assumed.
<curveto>
void curveto(double x1, double y1, double x2, double y2,
double x3, double y3);
or
void curveto(double *array,int first,int last);
or
void curveto(double *array);
Adds Bezier curve sections to the current path starting
at the current point. The curve starts tangent to
(xcur,ycur) - (x1,x2) and ends tangential to (x2,y2) -
(x3,y3) at (x3,y3); An error is generated if there is no
current point. The number of coordinate points must be
a multiple of three else an error is generated.
Several formats are allowed. The first is a list
of coordinate pairs. The second format is a pointer to a 2D
array of coordinate pairs followed by an optional pair of
integers specifying the first and last pairs to be plotted.
<drawdata>
void drawdata(double *data, int xcol, int ycol,...);
Draws the data contained in the array data in the current
axes_box. The numbers xcol and ycol are the columns of the
array data that are to be used for the x-axis and y-axis
data respectively. Each row of the array data represents
one coordinate point to be plotted. The values will be
plotted using the internal coordinate system established by
the the call to axes_box. If there is no current axes box
an error will be generated. The xcol and ycol params are
optional. If no values are given then xcol = 0 and ycol = 1
are assumed. For the popular case of one column of x values
and a set of y values the whole set may be plotted using
plotdata(data,xcol,ALL_Y);. drawdata() is implicitly stroked.
More than one data set with corresponding xcol and ycol may
be specified.
<errorbars>
void errorbars(int axes,double *data, int xcol, int ycol,
int errcol);
Draws error bars for the data points in the array "data".
The first parameter is either XVALS or YVALS indicating
along which axes the error bars are to be drawn. The
numbers xcol and ycol are the columns of the array data
that are to be used for the x-axis and y-axis data
respectively. Each row of the array data represents one
coordinate point to be plotted. The values will be plotted
using the internal coordinate system established by the the
call to axes_box. The last parameter "errcol" is the column
of the array "data" which holds the size of the error for
the corresponding data point in the same row. If there is
no current axes box an error will be generated.
errorbars() is implicitly stroked.
<epsfile>
void epsfile(char *filename);
Writes the current graphics image to a file with the
given name. The output format is encapsulated postscript.
Such a file can be printed on a postscript printer or
included as a graphic in many other programs. Warning! This
command does not check if it is over writting an existing
file.
<fill>
void fill();
Closes the current path if not already closed and fills the
interior region with the current colour as specified by the
last set() call. What is inside and what is outside the
path depends on the currently chosen fill rule. The fill
rule is either even-odd or non-zero wind (the default) and
is specified using a set() call. An error is generated if
there is no current path.
<fft>
void fft(double *data, int rcol, int icol, char inv>
Does a fast Fourier transform of the data. The last
parameter is optional and if TRUE the inverse
transform is done. The rcol parameter specifies the
column of data which is the real part while icol is
the column of data which is the imaginary part. To do
a transform of a real function just arrange to have a
column of zeros in your data. Note that the number of
rows in the data set must be a multiple of 2. If not
add rows to pad.
<fitline>
void fitline(double *data, int xcol,
int ycol,double *yint,double *slope);
Fits the best straight line to the data in the array "data"
using the column xcol of the array as the x values and the
column ycol as the corresponding y values. The best line is
drawn constrained to the current axes box. If there is no
current axes box an error is generated. The last two
parameters are the returned values giving the y intercept
and slope of the fitted line. Note that they are pointers
to doubles which must be declared at the top of the
program. Given a declaration of the form:
double slope,yint;
Call fitline using:
fitline(data,0,1,&yint,&slope);
Assuming that the first and second column of data are the x
and y values respectively. Data points can be excluded from
the fit by using the set(XRANGE,xmin,xmax); or
set(YRANGE,ymin,ymax); commands. Only data points within
the limits will be used for the fit. fitline() is
implicitly stroked.
<get>
int or double get(int option, char *str);
Returns the value of the specified option in the current
graphics state. The numerical value for single valued
elements is returned by the function otherwise the return
value is 0. A text representation of the value is optionally
returned in str. If used, be sure to allocate a character
array with sufficient space for str before calling this
function as in char str[80]; at the top of the program. The
valid option values are defined in splot.h. See also set()
for a description of the various options. The returned
string can be printed using the command puts(str); in the
program where "str" is the name of the array in the call to
get(). Returned numerical values can be printed using
print(value); The second array parameter is optional and is
only really needed for getting options that are more than
just a single value such as line patterns.
<grestore>
void grestore();
Pops a graphics state off the state stack thereby restoring
the graphics state that was in effect at the time the
matching gsave() was executed. In particular, the path, the
clip path, the line styles, line colours etc. are restored
to their previous values.
<gsave>
void gsave();
Pushes the current graphics state onto the state stack. The
current path, clip path, line style, colour etc. are saved
so that they can be restored later using a grestore()
command.
<label>
void label(int axis, char *label);
Add labels to the axes box previously defined. The first
parameter is which axis to label either BOTTOM, TOP, LEFT
or RIGHT. The following parameter is the label to be
printed. The label will be printed centered between the
appropriate edges of the current axes box. An error is
generated if there is no current axes box. All labels
should be after plotdata() if used otherwise spacing from
the axes may not be correct. The spacing can also be
changed using set(LABELMARG,...);. label() is implicitly
stroked.
<lineto>
void lineto(double x,double y,...);
or
void lineto(double *array,int first,int last);
or
void lineto(double *array);
Adds a line segment to the current path from the current
point to (x,y). More than one coordinate point can be
specified in the command in which case a series of line
segments connecting the points will be added to the current
path. If there is no current point then an error will be
generated. Several formats are allowed. The first is a list
of coordinate pairs. The second format is a pointer to a 2D
array of coordinate pairs followed by an optional pair of
integers specifying the first and last pairs to be plotted.
<moveto>
void moveto(double x, double y);
Sets the current point to (x,y). Also sets the path close
point to (x,y) for subsequent use with closepath(). Many
path building commands such as curveto() and lineto() require
that a current point exist before calling them.
<newpath>
void newpath();
Resets the current path to NULL and also causes the current
point to be undefined. Furthermore, it turns off the
implicit stroking of elements that are normally implicitly
stroked such as text();. Thus using newpath(); these
elements can be added to a path which must then be
explicitly stroked. stroke() turns on implicit stroking
again.
<plotdata>
void plotdata(double *data, int xcol, int ycol,...);
Plots the data found in array data in a box. This command
chooses the scale sizes tick marks etc. to display the data
which is assumed to be in order of monotonically increasing
or decreasing x value order. The parameters xcol and ycol
specify which columns of the array data to use for the x
and y values respectively. The xcol and ycol params are
optional. If no values are given then xcol = 0 and ycol = 1
are assumed. For the popular case of one column of x values
and a set of y values the whole set may be plotted using
plotdata(data,xcol,ALL_Y);. If the default choices of
plotdata are not acceptable a plot can be generated using
the step by step method using axes_box(), tickmarks(),
ticklabels() and drawdata(). The data must first be read in
to array data using readdata(). plotdata() is implicitly
stroked. More than one data, xcol, ycol triplet may be
entered in which case the auto scaling ensures that the box
is scaled to the max of all the data sets.
<rarrowto>
void rarrowto(double x, double y,...);
Adds a line segment to the current path from the current
point to the current point plus x, y. The line is
terminated by drawing an arrow head oriented in the
direction of the line. This command is identical to arrowto
except that the displacement is specified relative to the
current point. More than one coordinate point can be
specified in the command in which case a series of line
segments terminated by arrows connecting the points will be
added to the current path. If there is no current point
then an error will be generated. The size of the arrow
head may be changed with the set(FONTWIDTH,...); command.
<readdata>
void readdata(char * filename, double * data, int mod);
Reads a file of name filename and puts the data into the
array "data". The file should be in ASCII format with the x
data in one column and the y data values next column(s).
Any line containing non numeric characters or is blank will
be considered a comment and ignored. WARNING! As an
optimization data is only read from disk once if the
configuration parameter always_load is off. Subsequent
executions use the stored data already in memory (except
after a reset). This means that if you modify the array
"data" after reading in values the next time the file is
executed you will get strange results. Similarly, if you
reuse the same array for different plots in the same
drawing you will have trouble. The motto is never change
the values in the array "data". If you want to change the
values declare another array and copy the values. Also
remember that readdata() implicitly allocates memory for
the data array so it is correct to declare the data array
as double *data; at the top. If however, you are going to
fill in a new array with calculated values you need to
declare the array as double newdata[ysize][xsize]; so that
space will be allocated. The last parameter is optional
and if included and non-zero the data is read in as a
single dimension array. Furthermore, x values are not
generated if there is just a single column of numbers in
the file. This modified form of readdata is useful for
reading in numbers into an array to be used in lineto()
etc.
<rcurveto>
void rcurveto(double x1, double y1, double x2, double y2,
double x3, double y3);
or
void rcurveto(double *array,int first,int last);
or
void rcurveto(double *array);
This is identical to curveto() except that the list of
coordinates are all relative distances from previous point.
Adds Bezier curve sections to the current path starting
at the current point. The curve starts tangent to
(xcur,ycur) - (x1,x2) and ends tangential to (x2,y2) -
(x3,y3) at (x3,y3); An error is generated if there is no
current point. The number of coordinate points must be
a multiple of three else an error is generated.
Several formats are allowed. The first is a list
of coordinate pairs. The second format is a pointer to a 2D
array of coordinate pairs followed by an optional pair of
integers specifying the first and last pairs to be plotted.
<reset>
void reset();
Restores all set able parameters to their default values.
Clears the current path and clip path.
<rlineto>
void rlineto(double x,double y,...);
or
void rlineto(double *array,int first,int last);
or
void rlineto(double *array);
Adds a line segment to the current path from the current
point to the current point plus x, y. This command is
identical to lineto except that the displacement is
specified relative to the current point. More than one
coordinate point can be specified in the command in which
case a series of line segments connecting the points will
be added to the current path. If there is no current point
then an error will be generated. Several formats
are allowed. The first is a list of coordinate pairs. The
second format is a pointer to a 2D array of coordinate
pairs followed by an optional pair of integers specifying
the first and last pairs to be plotted.
<rmoveto>
void rmoveto(double x, double y);
Sets the current point to the current point plus x,y. This
command is the same as moveto except that a relative move
is specified. It also sets the path close point for
subsequent use with closepath(). Many path building
commands such as curveto and lineto require that a current
point exist before calling them.
<rotate>
void rotate(double ang);
Rotates the figure about the
current origin by the the angle
specified. The angle units are
degrees and the +ve direction
is counterclockwise.
Changes in rotation are cumulative.
<rsplineto>
void rsplineto(double x1,y1,x2,y2,...);
or
void rsplineto(double *array,int first,int last);
or
void rsplineto(double *array);
This is identical to splineto() except that the list of
coordinates are all relative distances from previous point.
This function accepts a list of two or more coordinate
pairs and using the current point as the first point draws
a cubic spline which goes through all of the given
coordinates. It uses Bezier curves internally but
calculates the necessary control points in order to make
the derivative continous everywhere. An error is generated
if there is no current point. Specifying less than two
additional points also generates an error. Several formats
are allowed. The first is a list of coordinate pairs. The
second format is a pointer to a 2D array of coordinate
pairs followed by an optional pair of integers specifying
the first and last pairs to be plotted.
<scale>
void scale(double xs, double ys);
Changes the scale of the figure
by the factors specified for
the x and y axes respectively.
Changes in scale are cumulative.
<set>
void set(int option, ...);
All set able parameters can be set using the set command.
The first parameter specifies which option to set. The
defined constants corresponding to valid options are
defined in the header file splot.h. What follows is a very
brief description of all the values set able using set().
set(AXESCLIP,val);
If val is ON then the data values are clipped to the limits
of the axes box. This is temporarily added to the user set
clip limits if any. If val is OFF (the default) then the
user specified clip limits from the last clip() call are
used.
Alternatively the range of data values plotted can be set
using set(XRANGE,...); set(YRANGE,...); .
set(AXESTYPE,val);
AXESTYPE may be one of the following. LINEAR (the default),
LOGX, LOGY, LOGLOG, INVX, INVY, INVINV, INVXLOGY or
LOGXINVY. The position of data points and tickmarks are
automatically adjusted to account for the axes type.
set(CURSYMBOL,sym);
Sets the symbol to use when plotting data with symbols. sym
must be one of OCIRCLE,OSQUARE,OTRIANGLE,ODIAMOND
OSTAR,OARROW,PLUS,CROSS,MULT,CIRCLE,SQUARE,TRIANGLE,
DIAMOND,STAR,or ARROW. The default symbol is CIRCLE. The
size of a symbol can be changed using set(FONTWIDTH,
val_in_cm); since symbols are just a special font.
The size of a symbol can be changed using set(FONTWIDTH,
val_in_cm); since symbols are just a special font. The
size relative to the current FONTWIDTH can be set using
set(SYMMULT,mult);.
set(FILLRULE,type);
Determines the rule to be used when filling a path. Type
must be one of NONZWIND (default) or EVENODD.
set(FLATNESS,num);
Sets the maximum allowable error in pixels when converting
a curve to a set of straight line segments. Smaller values
of num give smother curves but take longer to process. The
default value of num is 1.
set(FONT,fonttype);
Sets the font type to use for subsequent text written using
the text(); routine. fontname type be either SIMPLEX
(default) or COMPLEX.
set(FONTASPECT,asp);
Sets the ratio of the glyph height to width used for text
written using text();. The default value is 2.0
set(FONTDIR,angle);
Sets the rotation angle with respect to the x axis to use
when writing text using text(); The default is 0.
set(FONTMULT,factor);
Multiplies the current font size by the given factor.
set(FONTWIDTH,wid);
Sets the average width of the characters written using
text(). The default value is 0.7 cm. FONTWIDTH applies also
to symbols.
set(LABELMARG,val);
Sets the additional margin between the axes box and the
labels. The default is 0.0 cm.
set(LINECAP,type);
Determines how thick lines are to be terminated. The
allowed types are BUTTCAP (default), ROUNDCAP and PROJCAP.
set(LINECOLOUR,col);
Where col is one of INVIS, BLACK, BLUE, GREEN, CYAN, RED,
MAGENTA, BROWN or WHITE. This set the colour to use when
the current path is stroked or filled. The default colour
is BLACK with the background WHITE.
set(LINEJOIN,type);
Determines how thick lines are joined together. The allowed
join types are MITERJOIN (default), BEVELJOIN and
ROUNDJOIN.
set(LINESTYLE,pattern,...);
Sets the line style to use for the path when it is stroked.
The constant LINESTYLE is followed by a list of floating
point values that define the pattern. The values are
interpreted as the length along the path that the line is
visible followed by the length that it is invisible as an
alternating sequence wrapping back to the beginning when
the pattern reaches the end. For example a pattern of
1.0,1.0 implies on for 1 cm followed by off for 1 cm. A
pattern of 1.0,0.5 is on for 1 cm followed by off for 0.5
cm. The predefined patterns are: SOLID 0 (default) DASHED
1.0,0.5 DOTTED 0.2,0.2 and DOTDASH 1.0,0.5,0.2,0.5. There
must always be an even number of comma separated values
in a pattern definition.
set(LINEWIDTH,width);
Sets the line width to width cm (default 0.05 cm). This
line width is used when the current path is stroked.
set(MITERLIMIT,maxratio);
Sets the maximum length of spikes formed by miter joining
two lines at an acute angle. If the ratio of the length of
the spike to the width exceeds the value of maxratio then a
BEVELJOIN is done instead. The default value is 10.0.
set(PAGEROT,flag);
Selects landscape orientation if flag is ON.
Default is portrait.
set(PATTOFF,offset);
Sets the offset into the current LINESTYLE pattern. Can be
used to adjust the starting point of a pattern for aesthetic
reasons.
set(PLOTTYPE,type);
Sets the current plot type. type must be one of LINES
(default), SYMBOLS or SYM_LINES. LINES connects data points
with line segments while SYMBOLS causes the current symbol
to be drawn at each data point. SYM_LINES does both.
The size of a symbol can be changed using set(FONTWIDTH,
val_in_cm); since symbols are just a special font. The size
relative to the current FONTWIDTH can be set using
set(SYMMULT,mult);.
set(SCALEALL,val);
If val is ON then the XSHIFT, YSHIFT, XMULT, YMULT values
are applied to all coordinates (i.e. in lineto, moveto etc.).
The default is OFF in which case only data plotted using
plotdata or drawdata is affected by these values.
set(SCRIPTSCALE,val);
Sets the relative height of a super/sub script as compared
to ordinary text. The default value is 0.5.
set(SCRIPTSHIFT,val);
Sets the distance that a super/sub script is shifted
above/below ordinary text. The value is specified as a
fraction of the ordinary text height. The default value is
0.7.
set(SYMMULT,val)
Sets the symbol size multiplier used when drawing symbols.
The default value is 1.0. The actual symbol size is
determined the current FONTWIDTH multiplied by the curent
SYMMULT value.
set(TICKLENGTH,len);
Sets the length of axis tick marks to be used. The default
value is 0.3 cm.
set(TICKLMARG,len);
Sets the margin between the axes box and the tick labels.
The default is 0.0 cm.
set(XMULT,xmul);
Causes each x value to be multiplied by xmul before being
plotted.
set(XRANGE,xmin,ymin);
data plotted using drawdata is constrained to have x
values between xmin and xmax. There is also a corresponding
YRANGE set option. The default is no constraints. The
values should be specified in user coordinates i.e. those
established by the current axes_box() or ascale().
set(XSHIFT,xshft);
Causes the value xshft to be added to all x values before
plotting.
set(YMULT,ymul);
Causes each y value to be multiplied by ymul before being
plotted.
set(YSHIFT,yshft);
Causes the value yshft to be added to all y values before
plotting.
<showpage>
void showpage();
Transfers the marked page created in memory by the stroke
and fill commands to the physical page. This is
automatically done at the end of the file and thus this
command is only needed if it is desirable to draw parts
of the figure before the end of execution.
<smooth>
void smooth(double *data,int col, int pnts,char wrap)
Does a pnts point smooth on the specified column of
the data array. The last parameter specifies that the
data is cyclical and that to smooth the endpoints the
algorithm should wrap around back to the beginning or
end. The last two parameters are optional and are set
to 5 and FALSE by default.
<splineto>
void splineto(double x1,y1,x2,y2,...);
or
void splineto(double *array,int first,int last);
or
void splineto(double *array);
This function accepts a list of two or more coordinate
pairs and using the current point as the first point draws
a cubic spline which goes through all of the given
coordinates. It uses Bezier curves internally but
calculates the necessary control points in order to make
the derivative continous everywhere. An error is generated
if there is no current point. Specifying less than two
additional points also generates an error. Several formats
are allowed. The first is a list of coordinate pairs. The
second format is a pointer to a 2D array of coordinate
pairs followed by an optional pair of integers specifying
the first and last pairs to be plotted.
<stroke>
void stroke();
Marks the page in memory with the current path. The path
coordinates are transformed using the current coordinate
transformation matrix and the path is fleshed out using the
current line width, style and colour in effect at the time
of the stroke command.
<symbol>
void symbol(double x, double y, int symbol_const);
or
void symbol(int symbol_const);
Plots the symbol chosen by symbol_const at the point x,y.
symbol_const must be one of OCIRCLE, OSQUARE, OTRIANGLE,
ODIAMOND OSTAR, OARROW, PLUS, CROSS, MULT, CIRCLE, SQUARE,
TRIANGLE, DIAMOND, STAR,or ARROW. If the point x,y is
omitted the symbol is drawn at the current point as set
by a previous moveto();. symbol() is not implicitly
stroked so follow with a stroke();. The size of a symbol
can be changed using set(FONTWIDTH, val_in_cm); since
symbols are just a special font. The size relative to the
current FONTWIDTH can be set using set(SYMMULT,mult);.
<text>
void text(double x, double y, char * str,int just);
Adds the text string str to the current path starting at
location (x,y). The current font, size and orientation as
set using the set() command are used. Super/sub scripts can
be entered as ^2^ and _2_ respectively. Letters surrounded
by '!' or '#' are printed in Greek or italics respectively.
For example !m! generates the Greek lower case mu. The
special characters "^_!#$\" can be printed by preceding them
with \ as in \!. The combination \b back spaces by one
character. Symbols may be included in the text string by
enclosing them with $ as in $3$.
If the starting x,y coordinates are omitted then
the current string is positioned one line below the
previous string added to the path using text(). The last
parameter is the justification and must be one of LEFT,
RIGHT or CENTER. This last parameter can be omitted in
which case the default value of LEFT will be used. text()
is implicitly stroked.
<ticklabel>
void ticklabel(int axis, double v, char *label,...);
Add tick labels to the axes box previously defined. The
first parameter is which axis to label either BOTTOM, TOP,
LEFT or RIGHT. The following parameters are paired values
giving the tick position in data coordinates as established
by a prior call to axes_box() or ascale() and the text
string to be placed at that location. An error is generated
if there is no current axes_box. There are several default
possibilities. If 'ticklabel();' is called without any
parameters then if tick marks have been generated
previously using 'tickmarks();' then they will be
selectively labelled along the left and bottom axes. If
only an axis parameter is given then the corresponding axis
tick marks if any will be labelled. If the axis parameter
is followed by a list of numbers only they will be
assumed to be both the tick position and the desired label.
If the numbers are paired with strings in the parameter
list then the number will be used as the tick label
position and the string will be used as the literal label.
The spacing between the tick labels and the axes box can be
changed using set(TICKLMARG,...); ticklabel() is implicitly
stroked.
<tickmarks>
void tickmarks(int axis, double v,...);
Add tick marks to the axes box previously defined. The
first parameter is which axis either BOTTOM , TOP, LEFT,
RIGHT ,XAXES or YAXES. The following numbers are the
positions were tickmarks are to to be placed. The length of
the ticks is set using a set(TICKLENGTH,val) command. The
tickmarks will be drawn using the current linestyle and
colour. The location of the ticks is specified in data
coordinates as established by the prior call to axes_box().
An error is generated if there is no current axes_box. All
the above parameters are optional. The default behaviour is
as follows. If all parameters are omitted tick marks will
be automatically generated for all axes. If only an axis
specifier is given then tick marks will be generated for
the corresponding axis or axes. In these cases
'tickmarks();' will try to find reasonable positions for a
set of tick marks. If this default behaviour is
unacceptable then the actual tick positions can be
specified as a list of values following the axis specifier.
If there is only one numeric value it is interpreted as a
tick spacing. tickmarks() is implicitly stroked.
<translate>
void translate(double tx, double ty);
Translates the origin of the
figure by the x and y distances
specified. Translations are
cumulative.
<whereis>
void whereis(double *x,double *y);
Returns the coordinates of the current point as set by the
last moveto(), lineto() etc.
<break>
C keyword
Used to prematurely terminate a loop;
Example:
for (i = 0;i< 100; i++)
{
if (cond == 1) break;
/* if cond == 1 break out of the
loop regardless of the value of
i and continue at end of loop. */
}
<case>
C keyword
Used in conjunction with a switch to select one of a set of
choices.
Example:
switch(code)
{
case 0:/* do something if code = 0*/
break;
case 1:/* do this if code = 1*/
break;
case 2:
case 3:/* do this if code = 1 or 2*/
break;
default:/* do this if none of the
above */
break;
}
<char>
C keyword
Used to allocate memory for a variable of size one byte.
All chars are between -128 and 127. All variable
declarations must be done outside of the main routine for
of the main routine for globals. Unlike standard C and more
like C++ local variable declarations for local variables
can be anywhere in the routine. Also specifying the size
of local arrays using variables rather than constants is
acceptable for the interperter.
Example:
char c;
Arrays of base types can be specified using the syntax:
char tmp[80];
Pointers to a base type are specified as
char *tp;
<continue>
C keyword
Used to skip the remainder of a loop and test the condition
again.
Example:
for (i = 0;i< 100; i++)
{
if (cond == 1) continue;
/* if not cond == 1 do the rest
of the loop below the above line
otherwise increment i and test
again. */
}
<default>
C keyword
Used in conjunction with a switch to select the remaining
not explicitly specified choices.
Example:
switch(code)
{
case 0:/* do something if code = 0*/
break;
case 1:/* do this if code = 1*/
break;
case 2:
case 3:/* do this if code = 1 or 2*/
break;
default:/* do this if none of the
above */
break;
}
<do>
C keyword
Used in conjunction with while to set up loops that are
executed at least once. For Example:
do
{
/* loop body */
}
while (cond == 1);
<double>
C keyword
Used to allocate memory for a double precision floating
point value. All variable declarations must be done outside
of the main routine for globals. Unlike standard C and more
like C++ local variable declarations for local variables
can be anywhere in the routine. Also specifying the size
of local arrays using variables rather than constants is
acceptable for the interperter.
Example:
double d;
Arrays of base types can be specified using the syntax (2 x
400 array):
double data[2][400];
Pointers to a base type are specified as
double *tp;
<else>
C keyword
Used as part of an if statement to select the converse
case. Example
if (cond == 1)
{
/* execute this if cond = 1 */
}
else
{
/* execute this if cond not 1 */
}
<float>
C keyword
Used to allocate memory for a single precision floating
point value. All variable declarations must be done outside
of the main routine for globals. Unlike standard C and more
like C++ local variable declarations for local variables
can be anywhere in the routine. Also specifying the size
of local arrays using variables rather than constants is
acceptable for the interperter.
Example:
float f;
Arrays of base types can be specified using the syntax (2 x
400 array):
float data[2][400];
Pointers to a base type are specified as:
float *tp;
<for>
C keyword
Used to set up loops which are meant to run for a
predetermined number of iterations. For example:
for (i = 0;i< 100; i = i + 2)
{
/* execute this loop body 50
times. i.e. until i = 100 with
i starting at zero and incremented
by 2 after each iteration */
}
<int>
C keyword
Used to allocate memory for a variable of size one integer.
All variable declarations must be done outside of the main
of the main routine for globals. Unlike standard C and more
like C++ local variable declarations for local variables
can be anywhere in the routine. Also specifying the size
of local arrays using variables rather than constants is
acceptable for the interperter.
Example:
int i,j;
Arrays of base types can be specified using the syntax (2 x
400 array):
int data[2][400];
Pointers to a base type are specified
as
int *tp;
<if>
C keyword
Used to conditionally execute a block of code depending if
the conditional expression is true (non zero) or false
(zero). Can be used in conjunction with the keyword else.
For example:
if (i > j && k != 10)
{
/* execute this block if i greater
than j and k not equal to 10 */
}
else
{
/* otherwise to this block */
}
<main>
C keyword
This is actually a function and is the starting point of
the code. The function main is called by hitting CTRL G.
The syntax is
main()
{
/* program to be executed */
}
<return>
C Keyword
This exits a sub routine and returns an optional value to
the calling routine. For example:
main()
{
int x;
i = sub(x);
print(i);
}
int sub(int x)
{
/* calculate i based on input x */
return i;
}
<short>
C keyword
Used to allocate memory for a variable of size one small
integer. All variable declarations must be done outside of
the main of the main routine for globals. Unlike standard
C and more like C++ local variable declarations for local
variables can be anywhere in the routine. Also specifying
the size of local arrays using variables rather than
constants is acceptable for the interperter.
Example:
short i,j;
Arrays of base types can be specified using the syntax (2 x
400 array):
short data[2][400];
Pointers to a base type are specified as
short *tp;
<switch>
C keyword
Used to select one of a number of choices based on the
value of the expression code.
Example:
switch(code)
{
case 0:/* do something if code = 0*/
break;
case 1:/* do this if code = 1*/
break;
case 2:
case 3:/* do this if code = 1 or 2*/
break;
default:/* do this if none of the
above */
break;
}
<unsigned>
C keyword
Used as a type modifier for the integer variable types
char, short, and int.
example
unsigned int ui;
<while>
C keyword
Used to construct loops which run an non predetermined
number of times. For example:
cond = 1;
while (code == 1)
{
/* execute this loop body until
something in here sets cond to
something other than 1. */
}